<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>constructor调用</title>
  </head>
  <body>
    <!-- constructor调用几次? -->
    <script>
      class Person {
        constructor(name, age) {
          console.log('constructor');
          this.name = name;
          this.age = age;
        }
      }

      const p1 = new Person('哈哈', 22);
      const p2 = new Person('cxh', 21);
      const p3 = new Person('cc', 20);
      // new 出来 多少个实例对象 就 调用几次

      function Doc(xy) {
        console.log('DOC', xy);
      }

      let doc = new Doc('--xy--');
      console.log(doc);
    </script>
  </body>
</html>
